<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf"%>
<script type="text/javascript" src="${ctx}/js/equip/file/equip_edit.js"></script>
<script type="text/javascript" src="${ctx}/laydate/laydate.js"></script>
<script type="text/javascript" src="${ctx}/js/jedate/jedate.js"></script>
<script type="text/javascript">
$(function(){
	jeDate({
		dateCell:"#installDate",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, 
		isClear:false,
		minDate:"2014-09-19 00:00:00"
	});
	jeDate({
		dateCell:"#regularMaintainDate",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, 
		isClear:false,
		minDate:"2014-09-19 00:00:00"
	});
	jeDate({
		dateCell:"#nextMaintainDate",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, 
		isClear:false,
		minDate:"2014-09-19 00:00:00"
	});
	jeDate({
		dateCell:"#beginDate",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, 
		isClear:false,
		minDate:"2014-09-19 00:00:00"
	});
	jeDate({
		dateCell:"#normalTime",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, 
		isClear:false,
		minDate:"2014-09-19 00:00:00"
	});
	
})
</script>
<link type="text/css" rel="stylesheet"
	href="${ctx}/laydate/theme/default/laydate.css" />
<style type="text/css">
.col-sm-3 {
	width: 15%;
	float: left;
}

.col-sm-9 {
	width: 85%;
	float: left;
}

label[class^="btn btn-default"] {
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/equip/file_editEntity.shtml">
		<input type="hidden" class="form-control checkacc"
			value="${equipfile.id}" name="equipFileFormMap.id" id="id">
		<section class="panel panel-default">
		<div class="form-group">
			<label class="col-sm-3 control-label">设备种类：</label>
			<div class="col-sm-9">
				<select class="form-control"
					name="equipFileFormMap.equipmentCategoryId">
					<c:forEach var="key" items="${categoryFormMap}">
						<option value="${key.id }"
							${key.id==equipfile.equipmentCategoryId ? 'selected' :'' }>${key.categoryName }</option>
					</c:forEach>
				</select>
			</div>
		</div>
		<div class="line line-dashed line-lg pull-in"></div>

		<div class="panel-body">
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">设备编号：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh"
						placeholder="请输入设备编号" name="equipFileFormMap.equipmentNo"
						id="workcenter_no" value="${equipfile.equipmentNo}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">出厂型号：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入出厂型号"
						name="equipFileFormMap.leaveModel"
						value="${equipfile.leaveModel }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">管理编号：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入管理编号"
						name="equipFileFormMap.managementNo"
						value="${equipfile.managementNo }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">制造厂商：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入制造厂商"
						name="equipFileFormMap.produceFactory"
						value="${equipfile.produceFactory }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">联系电话：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入联系电话"
						name="equipFileFormMap.telephone" value="${equipfile.telephone }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">厂家地址：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入厂家地址"
						name="equipFileFormMap.address" value="${equipfile.address }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">安装日期：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control"
						id="installDate" placeholder="请输入安装日期" name="equipFileFormMap.installDate"
						value="${equipfile.installDate }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">安装地点：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入安装地点"
						name="equipFileFormMap.position" value="${equipfile.position }">
				</div>
			</div>

			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">定期保养日期：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入定期保养日期"
					id="regularMaintainDate"	name="equipFileFormMap.regularMaintainDate"
						value="${equipfile.regularMaintainDate }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>


			<div class="form-group">
				<label class="col-sm-3 control-label">下次保养日期：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control"
						id="nextMaintainDate" placeholder="请输入下次保养日期" name="equipFileFormMap.nextMaintainDate"
						value="${equipfile.nextMaintainDate }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">开始使用日期：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control"
						id="beginDate" placeholder="请输入开始使用日期" name="equipFileFormMap.beginDate"
						value="${equipfile.beginDate }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">正常使用时间：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control"
					id="normalTime"	placeholder="请输入正常使用时间" name="equipFileFormMap.normalTime"
						value="${equipfile.normalTime }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">设备状态：</label>
				<div class="col-sm-9">
					<select class="form-control"
						name="equipFileFormMap.equipmentStatus">
						<option ${equipfile.equipmentStatus== null ? 'selected' :'' }>--请选择--</option>
						<option value="0"
							${equipfile.equipmentStatus==0 ? 'selected' :'' }>停用</option>
						<option value="1"
							${equipfile.equipmentStatus==1 ? 'selected' :'' }>正常</option>
						<option value="2"
							${equipfile.equipmentStatus==2 ? 'selected' :'' }>维护中</option>
						<option value="3"
							${equipfile.equipmentStatus==3 ? 'selected' :'' }>报废</option>

					</select>
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入正常使用时间"
						name="equipFileFormMap.remark" value="${equipfile.remark }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">设备零配件表：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入设备零配件表"
						name="equipFileFormMap.equipmentSparepartId"
						value="${equipfile.equipmentSparepartId }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">价格：</label>
				<div class="col-sm-9">
					<input type="text" class="form-control" placeholder="请输入价格"
						name="equipFileFormMap.price" value="${equipfile.price }">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-9">
					<select class="form-control" name="equipFileFormMap.status">
						<option value="1"
							<c:if test="${equipfile.status eq 1}"> SELECTED</c:if>>正常</option>
						<option value="2"
							<c:if test="${equipfile.status eq 2}"> SELECTED</c:if>>删除</option>

					</select>
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="panel panel-default">
				<div class="panel-body">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th style="text-align: center;width:176px;">零配件名称 </th>
								<th style="text-align: center;width:135px;">零配件型号</th>
								<th style="text-align: center;width:136px;">零配件规格</th>
								<th style="text-align: center;width:136px;">零配件厂家</th>
								<th style="text-align: center;width:136px;">零配件厂家电话</th>
								<th style="text-align: center;width:136px;">零配件厂家地址</th>
								<th style="text-align: center;"><input type="button"
									class="btn btn-primary" onclick="insert_row(this)" value="增加"></th>
								<th style="text-align: center;"><input type="button"
									class="btn btn-danger" onclick="deleteRow(this)" value="删除"></th>
							</tr>
						</thead>
						<tbody id="tbl">
							<c:forEach var="l" items="${findByPage}">
									<tr>
									<td>
										<div class="input-group">
											<input type="text" class="form-control"
												name="sparepartName" value="${l.sparepartName}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control"
												name="sparepartModel" value="${l.sparepartModel}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" min="0" class="form-control"
												name="sparepartSpecification" value="${l.sparepartSpecification}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text"  class="form-control"
												name="sparepartFactory" value="${l.sparepartFactory }">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text"  class="form-control"
												name="factoryTelephone" value="${l.factoryTelephone}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text"  class="form-control"
												name="factoryAddress" value="${l.factoryAddress}">
										</div>
									</td>
									<td><input type="button" class="btn btn-primary"
										onclick="insert_row(this)" value="增加"></td>
									<td><input type="button" class="btn btn-danger"
										onclick="deleteRow(this)" value="删除"></td>
									</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<footer class="panel-footer text-right bg-light lter">
		<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer> </section>
	</form>
	<script type="text/javascript">
		var i = 0
		function insert_row(obj) {
			i++;
			R = tbl.insertRow(tbl.rows.length);
			C = R.insertCell(0);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="sparepartName"></div>';
			C = R.insertCell(1);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="sparepartModel"></div>';
			C = R.insertCell(2);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="sparepartSpecification"></div>';
			C = R.insertCell(3);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="sparepartFactory"></div>';
			C = R.insertCell(4);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="factoryTelephone"></div>';
			C = R.insertCell(5);
			C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="factoryAddress"></div>';		
			C = R.insertCell(6);
			C.innerHTML = '<input type="button" class="btn btn-primary" onclick ="insert_row(this)" value = "增加">';
			C = R.insertCell(7);
			C.innerHTML = '<input type="button" class="btn btn-danger" onclick ="deleteRow(this)" value ="删除">';
		}
		function deleteRow(obj) {
			var i = obj.parentNode.parentNode.rowIndex;
			if (i > 0) {
				tbl.deleteRow(i-1);
			}
		}
	</script>
</body>
</html>